<%@page import="java.util.HashMap"%>
<%@page import="java.util.Map"%>
<%@page import="java.util.Iterator"%>
<%@page import="org.lzy.pt.BaseInfo1"%>
<%@page import="java.util.List"%>
<%@page import="org.lzy.pt.BaseInfo"%>
<%@page import="org.lzy.pt.BaseInfoManager"%>
<%@ page import="org.jivesoftware.openfire.PresenceManager,
                 org.jivesoftware.openfire.admin.AdminManager,
                 org.jivesoftware.openfire.group.Group,
                 org.jivesoftware.openfire.user.User,
                 org.jivesoftware.openfire.user.UserManager,
                 org.jivesoftware.openfire.user.UserNotFoundException"
    errorPage="error.jsp"
%>
<%@ page import="org.jivesoftware.util.JiveGlobals"%>
<%@ page import="org.jivesoftware.util.LocaleUtils"%>
<%@ page import="org.jivesoftware.util.ParamUtils"%>
<%@ page import="org.xmpp.packet.JID"%><%@ page import="org.xmpp.packet.Presence"%>
<%@ page import="java.net.URLEncoder" %>
<%@ page import="java.util.Collection" %>
<%@ page import="org.jivesoftware.util.StringUtils" %>

<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jstl/fmt_rt" prefix="fmt" %>
<jsp:useBean id="webManager" class="org.jivesoftware.util.WebManager" />

<%  // Get parameters //
    String username = ParamUtils.getParameter(request,"username");
    // Load the user object
    User user = null;
    try {
        user = webManager.getUserManager().getUser(username);
    }
    catch (UserNotFoundException unfe) {
    }

    PresenceManager presenceManager = webManager.getPresenceManager();
    Boolean lockedOut = false;
    Boolean pendingLockOut = false;
    if (webManager.getLockOutManager().getDisabledStatus(username) != null) {
        // User is locked out. Check if he is locket out now
        if (webManager.getLockOutManager().isAccountDisabled(username)) {
            lockedOut = true;
        }
        else {
            pendingLockOut = true;
        }
    }
    Map<String, Object> baseInfo = BaseInfoManager.getInstance().findBaseInfoMap(username);
    List<BaseInfo1> baseInfos1 = BaseInfoManager.getInstance().findBaseInfo1(username);
%>

<html>
    <head>
        <title><fmt:message key="user.properties.title"/></title>
        <meta name="pageID" content="user-summary-custom"/>
    </head>
    <body>

<p>
<fmt:message key="user.properties.info" />
</p>
<% if (user == null) { %>
    <div class="warning">
    <table cellpadding="0" cellspacing="0" border="0">
    <tbody>
        <tr>
        <td class="jive-icon-label">
            <fmt:message key="error.specific_user_not_found">
                <fmt:param value="<%= StringUtils.escapeHTMLTags(username)%>" />
            </fmt:message>
        </td></tr>
    </tbody>
    </table>
    </div><br>
<%  } %>

<div class="jive-table">
<table cellpadding="0" cellspacing="0" border="0" width="100%">
<thead>
    <tr>
        <th colspan="2">User Base Info</th>
    </tr>
</thead>
<tbody>
	<% if (baseInfo != null) { %>
	    <% if (user == null) { %>
		    <tr>
		        <td colspan="2" align="center"><fmt:message key="error.requested_user_not_found" /></td>
		    </tr>
	    <% } else { %>
		    <% 
		      for(Iterator<Map.Entry<String,Object>> it=baseInfo.entrySet().iterator();it.hasNext();){
		    		Map.Entry<String,Object> entry = it.next();
		    %>
		    	<tr>
			        <td class="c1"><%=entry.getKey() %>:</td>
			        <td><%= entry.getValue() %></td>
			    </tr>
		    <% } %>
    	<% } %>
    <% } else { %>
    	<tr><td class="c1" colspan="2">no results</td></tr>
    <% } %>
</tbody>
</table>
</div>

<% if (baseInfos1 != null && baseInfos1.size() > 0) { %>
<br><br>
<p>
<%-- <fmt:message key="user.properties.info" /> --%>
User Base Info1
</p>
<div class="jive-table">
<table cellpadding="0" cellspacing="0" border="0" width="100%">
<thead>
    <tr>
        <th>T_Rssi</th>
        <th>T_Lac</th>
        <th>T_Cid</th>
        <th>T_Psc</th>
        <th>T_NetworkType</th>
        <th>T_describeContents</th>
    </tr>
</thead>
<tbody>
	<%
 	for(Iterator<BaseInfo1> it = baseInfos1.iterator();it.hasNext();){
 		BaseInfo1 baseInfo1 = it.next();
	%>
    <tr>
        <td><%= baseInfo1.getT_Rssi() %></td>
        <td><%= baseInfo1.getT_Lac() %></td>
        <td><%= baseInfo1.getT_Cid() %></td>
        <td><%= baseInfo1.getT_Psc() %></td>
        <td><%= baseInfo1.getT_NetworkType() %></td>
        <td><%= baseInfo1.getT_describeContents() %></td>
    </tr>
    <% } %>
 </tbody>
 </table>
 </div>
<% } %>

<%-- <% if (user != null && !UserManager.getUserProvider().isReadOnly()) { %> --%>
<br><br>
<form action="user-summary-custom.jsp">
<input type="hidden" name="username" value="<%= user.getUsername() %>">
<input type="submit" value="<fmt:message key="system.emailtest.cancel" />">
</form>

<%-- <% } %> --%>

</body>
</html>